package com.server.service.impl;

import com.pojo.entity.Collection;
import com.server.mapper.CollectionMapper;
import com.server.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CollectionServiceImpl implements CollectionService {
    @Autowired
    CollectionMapper collectionMapper;
    @Override
    public Integer insertCollection(Collection collection) {
        return collectionMapper.insertCollection(collection);
    }

    @Override
    public List<Collection> selectCollectionByUserId(Integer userId) {
        return collectionMapper.selectAll(userId);
    }

    @Override
    public Integer deleteCollection(Integer id) {
        return collectionMapper.deleteCollection(id);
    }

    @Override
    public List<Collection> selectCollectionByTitle(String title,Integer userId) {
        return collectionMapper.selectByTitle("%"+title+"%",userId);
    }
}
